load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "pdutil",
    srcs = [
        "pd.go",
        "utils.go",
    ],
    importpath = "github.com/pingcap/tidb/br/pkg/pdutil",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/errors",
        "//br/pkg/httputil",
        "//br/pkg/lightning/common",
        "//store/pdtypes",
        "//tablecodec",
        "//util/codec",
        "@com_github_coreos_go_semver//semver",
        "@com_github_docker_go_units//:go-units",
        "@com_github_google_uuid//:uuid",
        "@com_github_opentracing_opentracing_go//:opentracing-go",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_log//:log",
        "@com_github_tikv_pd_client//:client",
        "@org_golang_google_grpc//:grpc",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "pdutil_test",
    timeout = "short",
    srcs = [
        "main_test.go",
        "pd_serial_test.go",
    ],
    embed = [":pdutil"],
    flaky = True,
    shard_count = 8,
    deps = [
        "//store/pdtypes",
        "//testkit/testsetup",
        "//util/codec",
        "@com_github_coreos_go_semver//semver",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
